package com.cw.demo.binarysearch.basic;

/**
 * 递归二分查找法
 *
 * @author chenw
 * @date 2021/1/17
 */
public class BinarySearch {
    private static int recursiveFind(int[] arr,int start,int end,int target){
        if(start > end){
            return -1;
        }
        int mid = (start+end)/2;
        if(arr[mid] == target){
            return mid;
        }else if(arr[mid] > target){
            return recursiveFind(arr,start,mid-1,target);
        }else{
            return recursiveFind(arr,mid+1,end,target);
        }
    }
}
